fix: preserve explicit false SSL options#2639
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
09c4873 to
3e5c60a
Compare
|
Hi @fengjikui, Thanks for reaching out us! |
3e5c60a to
e22c1ed
Compare
|
Updated this branch on top of current Fresh local validation after the rebase:
Remote |
e22c1ed to
2ba3717
Compare
Fixes #2557.
Summary
client_args={"verify": False}/async_client_args={"verify": False}asFalsefor httpxasync_client_args={"ssl": False}asFalsefor aiohttp and websocket pathsFalsecasesRoot cause
The SSL helpers used truthiness checks such as
if not ctxandif not args.get(...). That makes an explicitFalseindistinguishable from an unset option, so the SDK replaced the user's disabled-verification setting with a defaultssl.SSLContext.Validation
env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy .venv/bin/python -m pytest google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_implicit_initialization google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_same_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_separate_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_sync_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_explicit_initialization_async_args google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_httpx_verify google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_aiohttp_ssl google/genai/tests/client/test_client_initialization.py::test_client_ssl_context_preserves_explicit_false_websocket_ssl -q(10 passed)env -u HTTP_PROXY -u HTTPS_PROXY -u ALL_PROXY -u http_proxy -u https_proxy -u all_proxy .venv/bin/python -m pytest google/genai/tests/client/test_client_initialization.py -q(90 passed)git diff --check